exports.mongoose = () => {
  const mongoose = require("mongoose");
  mongoose.connect(
    "mongodb://localhost:27017/koa",
    {
      useNewUrlParser: true,
      useUnifiedTopology: true,
    },
    (err, data) => {}
  );

  const Schema = new mongoose.Schema({
    name: { type: "String" },
    age: { type: "Number", default: 100 },
  });

  const demo = mongoose.model("newdemos", Schema);

  //   demo.create({ name: "ww" }).then((res) => {
  //     console.log(res);
  //   });

  //   demo.create({ name: "lss" }, { name: "www" }).then((res) => {
  //     console.log(res);
  //   });

  //   demo.find({ name: "zs" }).then((res) => {
  //     console.log(res);
  //   });

  //   demo.deleteOne().then((res) => {
  //     console.log(res);
  //   });

  //   demo.findByIdAndDelete({ _id: "612d72f2329644168c6fcdc9" }).then((res) => {
  //     console.log(res);
  //   });

  //   demo.deleteMany().then((res) => {
  //     console.log(res);
  //   });

  //   demo.updateOne({ name: "lss" }, { name: "zqq" }).then((res) => {
  //     console.log(res);
  //   });
};
